package cn.frank.framework.caesar.module.ai.openAi.basic;

import okhttp3.*;
import okhttp3.logging.HttpLoggingInterceptor;

/**
 * @description: TODO
 * @author: renjiangyang
 * @date 2025/6/10 13:39:25
 * @since 1.8
 */
public class OkHttpLoggingConfig {

    public static OkHttpClient createLoggingClient() {
        // 创建日志拦截器，打印请求和响应体
        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(System.out::println);
        loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); // BODY 输出全部内容

        return new OkHttpClient.Builder()
                .addInterceptor(loggingInterceptor)
                .build();
    }
}
